package com.hsq.spzx.utils;

import com.hsq.spzx.model.entity.system.SysUser;

/**
 * @author hsq
 * @date 2025-05-31 下午9:45
 */
public class AuthContextUtil {
    //1.创建ThreadLocal对象
    private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();

    //添加数据
    public static void set(SysUser sysUser) {
        threadLocal.set(sysUser);
    }

    // 定义获取数据的方法
    public static SysUser get() {
        return threadLocal.get() ;
    }

    //删除数据
    public static void remove(){
        threadLocal.remove();
    }
}
